<template>
	<view class="content">
		<image src="/static/Bank.png" style="width: 200rpx; height: 200rpx;" mode=""></image>
		<text style="font-size: 40rpx; font-weight: bold; margin-top: 50rpx;">签约成功</text>
		<view class="bottomView" @click="backAPP">
			返回应用
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			backAPP() {
				console.log('跳转')
				
				let url = 'https://xydparent.drcn.agconnect.link/uV7O'
				uni.setStorageSync('open_url', url);
				setTimeout(() => {
					if (!document.hidden) {
						window.location.href = url;
					}
				}, 300);
				
				// "ios" / "android" / "unknown"
				// let os = this.getDeviceOS()
				// uni.showToast({
				// 	title: os,
				// 	icon: 'none'
				// })
				// if (os == 'ios') {
				// 	let url = 'https://apps.apple.com/cn/app/%E4%B9%90%E5%AD%A6%E6%9C%89%E9%81%93/id1244644485'
				// 	uni.setStorageSync('open_url', url);
				// 	setTimeout(() => {
				// 		if (!document.hidden) {
				// 			window.location.href = url;
				// 		}
				// 	}, 300);
				// } else if (os == 'android') {
				// 	let url = 'https://m.malink.cn/s/fmuYzy'
				// 	uni.setStorageSync('open_url', url);
				// 	setTimeout(() => {
				// 		if (!document.hidden) {
				// 			window.location.href = url;
				// 		}
				// 	}, 300);
				// }
				
			},
			
			isWeChatBrowser() {
			  return /MicroMessenger/i.test(navigator.userAgent)
			},
			
			getDeviceOS() {
			  const ua = navigator.userAgent;
			  
			  // 优先判断 iOS
			  if (/iPhone|iPad|iPod/i.test(ua)) {
			    return "ios";
			  }
			  // 再判断 Android
			  else if (/Android/i.test(ua)) {
			    return "android";
			  }
			  // 微信浏览器可能隐藏 UA，需额外检查
			  else if (isWeChatBrowser()) {
			    return ua.includes("iPhone") ? "ios" : "android";
			  }
			  // 其他情况
			  else {
			    return "unknown";
			  }
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		background-color: #F7F9FD;
		flex: 1;
	}
	.bottomView {
		display: flex;
		position: fixed;
		bottom: 50rpx;
		width: 690rpx;
		align-items: center;
		justify-content: center;
		background: #508BFF;
		min-height: 90rpx;
		border-radius: 45rpx;
		color: white;
	}
</style>
